Added complexities - #11725
Conversation
| Space Complexity: | ||
| Best Case: O(log n) | ||
| Worst Case: O(n) |
There was a problem hiding this comment.
I'm not sure if this space complexity analysis is accurate for this specific implementation. From Wikipedia, it seems like the
There was a problem hiding this comment.
Yes, the best case is for in place it seems. I rechecked.
Since in place is the best way, should I implement with in-place method?
There was a problem hiding this comment.
#11752 In here I have changed the implementation
There was a problem hiding this comment.
🟡 Changes recommended
The documented space bounds do not match the out-of-place recursive implementation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request documents the time and space complexity of the existing quick sort implementation.
Changes:
- Adds best-, average-, and worst-case time complexity.
- Adds space-complexity documentation.
File summaries
| File | Description |
|---|---|
sorts/quick_sort.py |
Updates the quick_sort docstring with complexity details. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Space Complexity: | ||
| Best Case: O(log n) | ||
| Worst Case: O(n) |
Describe your change:
Added the various complexities for the quick sort algorithm
Checklist: